var imgs= document.getElementById("left").getElementsByTagName("img");
var pic1s= document.getElementById("left").getElementsByClassName("pic1");
	for(var i = 0;i<imgs.length;i++){
		pic1s[i].index = i+1;
		pic1s[i].index1 = i;
		pic1s[i].onclick = function(){
			tu.src = "images/man-mouse_"+this.index+".jpg";
			for(var j = 0 ; j<imgs.length;j++){
					pic1s[j].style.border = "none";
			}
			pic1s[this.index1].style.border = "1px solid black";
		}
	}
	
		function subtraction(){
            //获取-号按钮
            var subtraction = document.getElementById("subtraction");
            //获取文本框
            var number = document.getElementById("number");
            if (number.value<=1) {
                //如果文本框的值小于1,则设置值为1
                number.value = 1;
            }else {
                number.value = number.value - 1;
            }
        }
		function number(){
            var number = document.getElementById("number");
            var value = number.value;
            //如果文本值为空,设置为1
            if (value=="") {
                number.value = 1;
            }
            //如果文本值为非纯数字,设置为1
            //isNaN()是否为非法数字
            if (isNaN(value)) {
                number.value = 1;
            }
            //如果文本值小于1,设置为1
            if (parseInt(value)<=1) {
                number.value = 1;
            }
        }
		function add(){
            var add = document.getElementById("add");
            var number = document.getElementById("number");
            //parseInt() 将数值型字符串转换为数值
            number.value = parseInt(number.value)+1;
  }    
  
var spans= document.getElementById("size").getElementsByTagName("span");
	for(var i = 0;i<spans.length;i++){
		spans[i].index = i;
		spans[i].onclick = function(){
			for(var j = 0 ; j<spans.length;j++){
					spans[j].style.background = "";
					spans[j].style.color = "";
			}
			spans[this.index].style.background = "hotpink";
			spans[this.index].style.color = "white";
		}
	}
		


	
		